#ifdef BUFFER_MANAGER

#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include <list>

#define MAX_MSG_SIZE 	1024
#define MAX_BUFFER_SIZE 20
#define oops(msg)	{printf("server: "); perror(msg); exit(1);}

std::queue<char *> 	 buffer;
pthread_mutex_t		 buffer_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t		 buffer_add_flag = PTHREAD_COND_INITIALIZER;	
pthread_cond_t 	         buffer_pop_flag = PTHREAD_COND_INITIALIZER;	

int 	add_to_buffer(char *);
char 	*pop_from_buffer();
void 	del_from_buffer(char *);
void 	*distributor(void *);

#else

#include <queue>

#define MAX_MSG_SIZE 	1024

extern std::queue<char *> 	buffer;
extern pthread_mutex_t	 	buffer_lock; 
extern pthread_cond_t	 	buffer_add_flag;	
extern pthread_cond_t 	 	buffer_pop_flag;	

extern int 	add_to_buffer(char *);
extern char 	*pop_from_buffer();
extern void 	del_from_buffer(char *);
extern void 	*distributor(void *);

#endif
